package com.ruoyi.yuwen.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.yuwen.mapper.CodeMapper;
import com.ruoyi.yuwen.domain.Code;
import com.ruoyi.yuwen.service.ICodeService;

/**
 * 验证码Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-02-27
 */
@Service
public class CodeServiceImpl implements ICodeService 
{
    @Autowired
    private CodeMapper codeMapper;

    /**
     * 查询验证码
     * 
     * @param id 验证码主键
     * @return 验证码
     */
    @Override
    public Code selectCodeById(Long id)
    {
        return codeMapper.selectCodeById(id);
    }

    /**
     * 查询验证码列表
     * 
     * @param code 验证码
     * @return 验证码
     */
    @Override
    public List<Code> selectCodeList(Code code)
    {
        return codeMapper.selectCodeList(code);
    }

    /**
     * 新增验证码
     * 
     * @param code 验证码
     * @return 结果
     */
    @Override
    public int insertCode(Code code)
    {
        return codeMapper.insertCode(code);
    }

    /**
     * 修改验证码
     * 
     * @param code 验证码
     * @return 结果
     */
    @Override
    public int updateCode(Code code)
    {
        return codeMapper.updateCode(code);
    }

    /**
     * 批量删除验证码
     * 
     * @param ids 需要删除的验证码主键
     * @return 结果
     */
    @Override
    public int deleteCodeByIds(Long[] ids)
    {
        return codeMapper.deleteCodeByIds(ids);
    }

    /**
     * 删除验证码信息
     * 
     * @param id 验证码主键
     * @return 结果
     */
    @Override
    public int deleteCodeById(Long id)
    {
        return codeMapper.deleteCodeById(id);
    }

    @Override
    public Code selectCodeByPhone(String phone) {
        return codeMapper.selectCodeByPhone(phone);
    }
}
